package com.qire.manhua.model.viewModel.impl;

import com.qire.common.widget.adapter.auto.AutoVariable;
import com.qire.common.widget.adapter.auto.annotation.AdapterEntityBind;
import com.qire.manhua.R;
import com.qire.manhua.databinding.LayoutShareItemBinding;
import com.qire.manhua.model.enumeration.ShareType;

import java.util.ArrayList;

import androidx.databinding.BaseObservable;

@AdapterEntityBind(viewRid = R.layout.layout_share_item)
public class ShareItemViewModel extends BaseObservable implements AutoVariable<LayoutShareItemBinding> {

    public final int iconRid;
    public final int textRid;
    public final ShareType shareType;

    public ShareItemViewModel(int iconRid, int textRid, ShareType shareType) {
        this.iconRid = iconRid;
        this.textRid = textRid;
        this.shareType = shareType;
    }

    @Override
    public void bindVariable(LayoutShareItemBinding viewBind) {
        viewBind.setShareItemViewModel(this);
    }

    /**
     * 构建邀请好友的分享选项
     * @return
     */
    public static final ArrayList<ShareItemViewModel> buildToInviteFriends() {
        final ArrayList<ShareItemViewModel> list = new ArrayList<>();
        // 填充数据
        list.add(new ShareItemViewModel(R.drawable.app_share_item_icon_wechat, R.string.weChat, ShareType.WECHAT));
        list.add(new ShareItemViewModel(R.drawable.app_share_item_icon_qq, R.string.qq, ShareType.PLATFORM_QQ));
        list.add(new ShareItemViewModel(R.drawable.app_share_item_icon_qzone, R.string.qZone, ShareType.PLATFORM_QZONE));
        list.add(new ShareItemViewModel(R.drawable.app_share_item_icon_pic, R.string.savePic, ShareType.SAVE_PIC));
        list.add(new ShareItemViewModel(R.drawable.app_share_item_icon_qr_code, R.string.faceToFace, ShareType.FACE_TO_FACE));
        list.add(new ShareItemViewModel(R.drawable.app_share_item_icon_copy, R.string.copyLink, ShareType.COPY_LINKS));
        return list;
    }

    /**
     * 构建漫画分享的分享选项
     * @return
     */
    public static final ArrayList<ShareItemViewModel> buildToShareComic() {
        final ArrayList<ShareItemViewModel> list = new ArrayList<>();
        // 填充数据
        list.add(new ShareItemViewModel(R.drawable.app_share_item_icon_wechat_moments, R.string.weChatMoments, ShareType.WECHATMOMENTS));
        list.add(new ShareItemViewModel(R.drawable.app_share_item_icon_wechat, R.string.weChat, ShareType.WECHAT));
        list.add(new ShareItemViewModel(R.drawable.app_share_item_icon_qq, R.string.qq, ShareType.PLATFORM_QQ));
        list.add(new ShareItemViewModel(R.drawable.app_share_item_icon_qzone, R.string.qZone, ShareType.PLATFORM_QZONE));
        list.add(new ShareItemViewModel(R.drawable.app_share_item_icon_sina_weibo, R.string.sinaWeibo, ShareType.SINAWEIBO));
        list.add(new ShareItemViewModel(R.drawable.app_share_item_icon_copy, R.string.copyLink, ShareType.COPY_LINKS));
        return list;
    }

}
